﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Enterprise.Infrastructure;
using Enterprise.Model.WorkFlow;
using Enterprise.Service.WorkFlow;
using Enterprise.Service.User;
using Enterprise.Service.ZhiWu;
namespace Enterprise.UI.Web.Manage.WorkFlow
{
    public partial class DetailManage : System.Web.UI.Page
    {
        protected int Id = (int)Utility.sink("Id", Utility.MethodType.Get, 0, 0, Utility.DataType.Int);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnStart();
            }
        }

        private void OnStart()
        {
            OnBindWorkFlow();
        }

        private void OnBindWorkFlow()
        {
            if (Id == 0)
                return;

            WorkFlowInfoService wService = new WorkFlowInfoService();
            var q = wService.WorkFlowDisp(Id);
            if (q != null)
            {
                lb_Name1.Text = q.WFNAME;

                WorkFlowNodeService nodeService = new WorkFlowNodeService();
                List<WorkFlowNodeEntity> list = nodeService.WorkFlowNode(Id);
                GridView1.DataSource = list;
                GridView1.DataBind();
            }
        }

        /// <summary>
        /// 获取人员信息
        /// </summary>
        /// <param name="objectTypeId"></param>
        /// <param name="objectUser"></param>
        /// <returns></returns>
        protected string GetUser(int objectTypeId, int objectUser)
        {
            string str = "";
            if (objectTypeId == 0)
            {
                str = UserService.GetUserName(objectUser);
            }
            else if (objectTypeId == 1)
            {
                str = ZhiwuService.GetZhiWuName(objectUser);
            }
            return str;
        }

    }
}